﻿using RecruitStudents.Client.BLL;
using RecruitStudents.Utility;
using RecruitStudents.Utility.Helper;
using RecruitStudents.Utility.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RecruitStudents.Client.Base
{
    public partial class Base_ExamLevel_Option : BaseForm
    {
        ServiceBase service = new ServiceBase();
        string strDicNO = string.Empty;
        public Base_ExamLevel_Option(string dicNo)
        {
            InitializeComponent();
            strDicNO = dicNo;
            if (strDicNO.ToSafeString().Length > 0)
            {
                DataTable dt = service.GetDicValue("TB_Dic_ExamLevel", strDicNO);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        txtName.Text = dt.Rows[0]["DicName"].ToSafeString();
                        if (dt.Rows[0]["IsActive"].ToSafeString() == "1")
                        {
                            chkSFYX.Checked = true;
                        }
                        else
                        {
                            chkSFYX.Checked = false;
                        }
                    }
                }

            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
           
            TB_Dic_ExamLevel model = new TB_Dic_ExamLevel();
            if (strDicNO.ToSafeString().Length > 0)
            {
                model.DicNO = strDicNO;
            }
            model.DicName = txtName.Text;
            if (chkSFYX.Checked)
            {
                model.IsActive = "1";
            }
            else
            {
                model.IsActive = "0";
            }

            //if (service.SaveDic(model))
            //{
            //    this.DialogResult = DialogResult.OK;
            //    this.Close();
            //}
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
